PIC24F
CRC Peripheral Module Library Help
Table Of Contents
2 Using Library Functions in Your Code
4.3 SetPriorityIntCRC (priority)
4.4 CRC_Clear_Intr_Status_Bit()
4.5 Get_CRC_FIFO_FULL_STATUS()
4.6 Get_CRC_FIFO_EMPTY_STATUS ()
This peripheral library module:
· Implements a software configurable CRC generator.
· Incorporates a FIFO that is 8 deep when PLEN (PLEN<3:0>) > 7, and 16 deep otherwise.
Library routine parameters can be constructed using either AND based mask or AND_OR based mask setting. For more information on these masks, see 16-bit Peripheral Libraries.
Example of Use ( AND_OR mask )
Function Call:
CRC_Config (CRCXOR_VAL , (CRC_IDLE_STOP | CRC_POLYNOMIAL_LEN7 |
CRC_START_SERIAL_SHIFT));
Function Prototype |
UINT16 CRC_Calc_ChecksumWord(UINT16* data, UINT16 Number_of_words, UINT16 prev_CRC) |
Include |
crc.h |
Description |
This function calculates CRC checksum for the data provide by the user, based on the polynomial set in the CRCXOR register. |
Arguments |
data - Pointer to the first data word for which CRC needs to be calculated. Number_of_words - Total number of words for which CRC needs to be calculated. prev_CRC - previous CRC result. |
Return Value |
Returns Two Byte CRC checksum based on the set polynomial. |
Remarks: |
Input parameter is provided as a provision to allow continuation of previously being computed checksum. In case the checksum is being calculated for a fresh set of data then the input value for prev_CRC should be '0'. |
Source File: |
CRC_Calc_Checksum.c |
Function Prototype |
UINT16 CRC_Calc_ChecksumByte(UINT8* data, UINT16 Number_of_bytes, UINT16 prev_CRC) |
Include |
crc.h |
Description |
This function calculates CRC checksum for the data provide by the user, based on the polynomial set in the CRCXOR register. |
Arguments |
data - Pointer to the first data byte for which CRC needs to be calculated. Number_of_bytes - Total number of bytes for which CRC needs to be calculated. Prev_CRC - previous CRC result. |
Return Value |
Returns One Byte CRC checksum based on the set polynomial |
Remarks: |
Input parameter is provided as a provision to allow continuation of previously being computed checksum. In case the checksum is being calculated for a fresh set of data then the input value for prev_CRC should be '0'. |
Source File: |
CRC_Calc_Checksum.c |
Function Prototype |
void CRC_Config(UINT16 poly , UINT8 poly_len) |
Include |
crc.h |
Description |
This function configures CRC module. |
Arguments |
poly - Polynomial to calculate CRC poly_len - Length of polynomial CRC_POLYNOMIAL_LEN1 CRC_POLYNOMIAL_LEN2 …… CRC_POLYNOMIAL_LEN16 |
Return Value |
None |
Remarks: |
None |
Source File: |
CRC_Config.c |
Function Prototype |
void CRC_Config_INTR(UINT8 intr_byte) |
Include |
crc.h |
Description |
This function configures CRC interrupts. |
Arguments |
intr_byte - I2C interrupt priority and enable/disable information as defined below: CRC Interrupt enable/disable CRC_INT_ENABLE CRC_INT_DISABLE CRC Interrupt priority CRC_INT_PRIOR_7 CRC_INT_PRIOR_6 CRC_INT_PRIOR_5 CRC_INT_PRIOR_4 CRC_INT_PRIOR_3 CRC_INT_PRIOR_2 CRC_INT_PRIOR_1 CRC_INT_PRIOR_0 |
Return Value |
None |
Remarks: |
This function clears the Interrupt Flag bits, sets the interrupt priorities of master and slave and enables/disables the interrupt |
Source File: |
CRC_Config_INTR.c |
Macro |
EnableIntCRC |
Include |
crc.h |
Description |
This macro enables the CRC interrupt. |
Arguments |
None |
Remarks |
None |
Macro |
DisableIntCRC |
Include |
crc.h |
Description |
This macro disables the CRC interrupt. |
Arguments |
None |
Remarks |
None |
Macro |
SetPriorityIntCRC (priority) |
Include |
crc.h |
Description |
This macro sets priority for crc interrupt. |
Arguments |
priority - interrupt priority |
Remarks |
This macro sets CRC Interrupt Priority bits of Interrupt Priority Control register. |
Macro |
CRC_Clear_Intr_Status_Bit() |
Include |
crc.h |
Description |
Macro to Clear CRC Interrupt Status bit |
Arguments |
None |
Remarks |
None |
Macro |
Get_CRC_FIFO_FULL_STATUS() |
Include |
crc.h |
Description |
Macro to Return FIFO Full Status bit |
Arguments |
None |
Remarks |
None |
Macro |
Get_CRC_FIFO_EMPTY_STATUS () |
Include |
crc.h |
Description |
Macro to Return FIFO Empty Status bit |
Arguments |
None |
Remarks |
None |
Macro |
Start_CRC_Calulation() |
Include |
crc.h |
Description |
Macro to Start CRC Calculation |
Arguments |
None |
Remarks |
None |
Macro |
Stop_CRC_Calulation() |
Include |
crc.h |
Description |
Macro to Start CRC Calculation |
Arguments |
None |
Remarks |
None |